﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LatestNewFooterUC.ascx.cs"
    Inherits="VCN.home.UC.LatestNewFooterUC" %>
<div id="LatestNewFooterUC">
    <h2 class="h2-header">
        Latest News
    </h2>
    <div class="content">
        <%            
            VCN.App.DataAccessLayer.NewsDAO newDao = new VCN.App.DataAccessLayer.NewsDAO();
            VCN.App.DataTransferObjects.News v_new = newDao.selectLatestNews();
            if (v_new != null)
            {
                Response.Write(string.Format("<div class='title'><a href='./News.aspx?NId={0}'>{1}</a></div><div class='short-content'>{2}</div>", v_new.Id, (v_new.Title.Length > 80) ? v_new.Title.Substring(0, 80) + "..." : v_new.Title, (v_new.ShortContent.Length > 120) ? v_new.ShortContent.Substring(0, 120) + "..." : v_new.ShortContent));
        %>
        <div class="time">
            <%
                Response.Write(string.Format("{0} {1:00}:{2:00}:{3:00}", v_new.CreatedDate.ToString("dd/MM/yyyy"),
                    v_new.CreatedDate.Hour, v_new.CreatedDate.Minute, v_new.CreatedDate.Second));
            %>
        </div>
        <div class="button">
            <%
                Response.Write(string.Format("<a href='./News.aspx?NId={0}'>Read more</a>", v_new.Id));
                
            %>
        </div>
        <%} %>
    </div>
</div>
